    
    
    
    def _nmap(ip, args):
        
        if self.status == ExecStatus.new:
            logging.debug('%s scanning of %s running', self.type, self.task.addr.ip)
            self.start = datetime.datetime.now()
            self.status = ExecStatus.running
            
            try:
                result = nm.nmap_scan(ip, args)
            except:
                self.status = ExecStatus.error
                self.end = datetime.datetime.now()
                self.info = log.log_exception_without_trace(*sys.exc_info())
            else:
                            
                self.status = ExecStatus.complete
                self.end = datetime.datetime.now()
                filename = '{},{},{},{}'.format(self.task.addr.ip, self.type, self.status, self.end.isoformat('_') )
                logging.debug('filename: %s', filename)
                path = SCAN_REPORT_DIR + filename
                logging.debug('PATH : %s', path)
                
                try:
                    with open(path + '.xml', 'w') as f:
                        f.write(result['xml'])
                    utils.xml_to_html(path + '.xml', path + '.html')
                except:
                    self.info = log.log_exception_without_trace(*sys.exc_info())
                    self.xml = ExecStatus.error
                    self.html = ExecStatus.error
                else:
                    self.xml = SCAN_REPORT_LINK + '/' + filename + '.xml'
                    self.html = SCAN_REPORT_LINK + '/' +  filename + '.html'

                for res in result['services']:
                    res.update({'link' : self.html})
                    self.services.append(Service(**res))
                    pass
       
        
    def _openvas(ip, args):
        if self.status == ExecStatus.new:
            logging.debug('%s scanning of %s complete', self.type, self.task.addr.ip)
            self.status == ExecStatus.complete
            pass
        elif self.status == ExecStatus.running:
            pass
            